package com.javaweb.dao;

import com.javaweb.model.Article;
import com.javaweb.service.dto.ArticleConditionDto;
import com.javaweb.service.dto.ArticleDto;
import com.javaweb.service.dto.ArticleUpdateDto;

import javax.swing.plaf.PanelUI;
import java.util.Date;
import java.util.List;

public interface ArticleDao {
    /**
     * 新增新文章
     * @param
     * @return
     */
    public int updateStatus(Integer id, Integer status) ;
    public int insert(Article article)  ;
    public int updateContent(Integer id, String newContent) ;
    public int updateTitle(Integer id, String newTitle)  ;
    public int deleteById(Integer id) ;

    public List<Article> selectByUserId(Integer userId) ;

    public int selectId(Integer userId, String title, Date createTime) ;

    public List<Article> selectByKeyword(String keyword) ;

    public List<Article>  selectByTimePeriod(Date startTime, Date endTime);

    public List<Article>  selectByTag(Integer tagId);

    public List<Article> selectByCategory(Integer categoryId);

    public Article selectById(String articleId);

    public int countByConditions(ArticleConditionDto articleCond);

    public List<Article> selectByConditions(ArticleConditionDto articleCond, int fromIndex, int pageSize);

    public int updatearticle(Article article);


    // 根据条件查询文章
    public List<Article> findArticlesByConditions(ArticleConditionDto articleCond);

    //新增文章
    public void add(Article article);

    public boolean updateArticle(ArticleUpdateDto articleUpdateDto, List<Integer> tagIds);

    public boolean publishArticle(String articleId);

    void publish(String articleId);

    void save(ArticleDto articleDto);
}
